<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>QtWebApp: logging/logger.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">QtWebApp
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('logger_8h_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">logger.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="logger_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160; </div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#ifndef LOGGER_H</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#define LOGGER_H</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160; </div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &lt;QtGlobal&gt;</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &lt;QThreadStorage&gt;</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &lt;QHash&gt;</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;QStringList&gt;</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;QMutex&gt;</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;QObject&gt;</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="logglobal_8h.html">logglobal.h</a>&quot;</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="logmessage_8h.html">logmessage.h</a>&quot;</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160; </div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="keyword">namespace </span>stefanfrings {</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160; </div>
<div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="classstefanfrings_1_1Logger.html">   52</a></span>&#160;<span class="keyword">class </span>DECLSPEC <a class="code" href="classstefanfrings_1_1Logger.html">Logger</a> : <span class="keyword">public</span> QObject {</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;    Q_OBJECT</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;    Q_DISABLE_COPY(<a class="code" href="classstefanfrings_1_1Logger.html">Logger</a>)</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160; </div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    <a class="code" href="classstefanfrings_1_1Logger.html">Logger</a>(QObject* parent);</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160; </div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160; </div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    <a class="code" href="classstefanfrings_1_1Logger.html">Logger</a>(<span class="keyword">const</span> QString msgFormat=<span class="stringliteral">&quot;{timestamp} {type} {msg}&quot;</span>,</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;           <span class="keyword">const</span> QString timestampFormat=<span class="stringliteral">&quot;dd.MM.yyyy hh:mm:ss.zzz&quot;</span>,</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;           <span class="keyword">const</span> QtMsgType minLevel=QtDebugMsg, <span class="keyword">const</span> <span class="keywordtype">int</span> bufferSize=0,</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;           QObject* parent = <span class="keyword">nullptr</span>);</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160; </div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;    <span class="keyword">virtual</span> ~<a class="code" href="classstefanfrings_1_1Logger.html">Logger</a>();</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160; </div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> log(<span class="keyword">const</span> QtMsgType type, <span class="keyword">const</span> QString&amp; message, <span class="keyword">const</span> QString &amp;file=<span class="stringliteral">&quot;&quot;</span>,</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;                     <span class="keyword">const</span> QString &amp;<span class="keyword">function</span>=<span class="stringliteral">&quot;&quot;</span>, <span class="keyword">const</span> <span class="keywordtype">int</span> line=0);</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160; </div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    <span class="keywordtype">void</span> installMsgHandler();</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160; </div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> set(<span class="keyword">const</span> QString&amp; name, <span class="keyword">const</span> QString&amp; value);</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160; </div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> clear(<span class="keyword">const</span> <span class="keywordtype">bool</span> buffer=<span class="keyword">true</span>, <span class="keyword">const</span> <span class="keywordtype">bool</span> variables=<span class="keyword">true</span>);</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160; </div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;<span class="keyword">protected</span>:</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160; </div>
<div class="line"><a name="l00122"></a><span class="lineno"><a class="line" href="classstefanfrings_1_1Logger.html#ab7dada738f69e822329edd76889bb758">  122</a></span>&#160;    QString <a class="code" href="classstefanfrings_1_1Logger.html#ab7dada738f69e822329edd76889bb758">msgFormat</a>;</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160; </div>
<div class="line"><a name="l00125"></a><span class="lineno"><a class="line" href="classstefanfrings_1_1Logger.html#a04eed4523912a75a31d75589f9eb81db">  125</a></span>&#160;    QString <a class="code" href="classstefanfrings_1_1Logger.html#a04eed4523912a75a31d75589f9eb81db">timestampFormat</a>;</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160; </div>
<div class="line"><a name="l00128"></a><span class="lineno"><a class="line" href="classstefanfrings_1_1Logger.html#a032b8dabe616327d58e97b1a5c853f86">  128</a></span>&#160;    QtMsgType <a class="code" href="classstefanfrings_1_1Logger.html#a032b8dabe616327d58e97b1a5c853f86">minLevel</a>;</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160; </div>
<div class="line"><a name="l00131"></a><span class="lineno"><a class="line" href="classstefanfrings_1_1Logger.html#a9e6f76da976e3f09962c7613ad7aad8a">  131</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="classstefanfrings_1_1Logger.html#a9e6f76da976e3f09962c7613ad7aad8a">bufferSize</a>;</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160; </div>
<div class="line"><a name="l00134"></a><span class="lineno"><a class="line" href="classstefanfrings_1_1Logger.html#a724e09b39b88c5a880f2405a260949cb">  134</a></span>&#160;    <span class="keyword">static</span> QMutex <a class="code" href="classstefanfrings_1_1Logger.html#a724e09b39b88c5a880f2405a260949cb">mutex</a>;</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160; </div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;    <span class="keyword">virtual</span> <span class="keywordtype">void</span> write(<span class="keyword">const</span> <a class="code" href="classstefanfrings_1_1LogMessage.html">LogMessage</a>* logMessage);</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160; </div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160; </div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;    <span class="keyword">static</span> <a class="code" href="classstefanfrings_1_1Logger.html">Logger</a>* defaultLogger;</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160; </div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> msgHandler(<span class="keyword">const</span> QtMsgType type, <span class="keyword">const</span> QString &amp;message, <span class="keyword">const</span> QString &amp;file=<span class="stringliteral">&quot;&quot;</span>,</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;                           <span class="keyword">const</span> QString &amp;<span class="keyword">function</span>=<span class="stringliteral">&quot;&quot;</span>, <span class="keyword">const</span> <span class="keywordtype">int</span> line=0);</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160; </div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160; </div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;<span class="preprocessor">#if QT_VERSION &gt;= QT_VERSION_CHECK(5, 0, 0)</span></div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160; </div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> msgHandler5(<span class="keyword">const</span> QtMsgType type, <span class="keyword">const</span> QMessageLogContext&amp; context, <span class="keyword">const</span> QString &amp;message);</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160; </div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160; </div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> msgHandler4(<span class="keyword">const</span> QtMsgType type, <span class="keyword">const</span> <span class="keywordtype">char</span> * message);</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160; </div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160; </div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;    <span class="keyword">static</span> QThreadStorage&lt;QHash&lt;QString,QString&gt;*&gt; logVars;</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160; </div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;    QThreadStorage&lt;QList&lt;LogMessage*&gt;*&gt; buffers;</div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;};</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160; </div>
<div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;} <span class="comment">// end of namespace</span></div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160; </div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;<span class="preprocessor">#endif </span><span class="comment">// LOGGER_H</span></div>
<div class="ttc" id="aclassstefanfrings_1_1LogMessage_html"><div class="ttname"><a href="classstefanfrings_1_1LogMessage.html">stefanfrings::LogMessage</a></div><div class="ttdoc">Represents a single log message together with some data that are used to decorate the log message.</div><div class="ttdef"><b>Definition:</b> <a href="logmessage_8h_source.html#l00036">logmessage.h:37</a></div></div>
<div class="ttc" id="aclassstefanfrings_1_1Logger_html"><div class="ttname"><a href="classstefanfrings_1_1Logger.html">stefanfrings::Logger</a></div><div class="ttdoc">Decorates and writes log messages to the console, stderr.</div><div class="ttdef"><b>Definition:</b> <a href="logger_8h_source.html#l00052">logger.h:52</a></div></div>
<div class="ttc" id="aclassstefanfrings_1_1Logger_html_a032b8dabe616327d58e97b1a5c853f86"><div class="ttname"><a href="classstefanfrings_1_1Logger.html#a032b8dabe616327d58e97b1a5c853f86">stefanfrings::Logger::minLevel</a></div><div class="ttdeci">QtMsgType minLevel</div><div class="ttdoc">Minimum level of message types that are written out directly or trigger writing the buffered content.</div><div class="ttdef"><b>Definition:</b> <a href="logger_8h_source.html#l00128">logger.h:128</a></div></div>
<div class="ttc" id="aclassstefanfrings_1_1Logger_html_a04eed4523912a75a31d75589f9eb81db"><div class="ttname"><a href="classstefanfrings_1_1Logger.html#a04eed4523912a75a31d75589f9eb81db">stefanfrings::Logger::timestampFormat</a></div><div class="ttdeci">QString timestampFormat</div><div class="ttdoc">Format string of timestamps.</div><div class="ttdef"><b>Definition:</b> <a href="logger_8h_source.html#l00125">logger.h:125</a></div></div>
<div class="ttc" id="aclassstefanfrings_1_1Logger_html_a724e09b39b88c5a880f2405a260949cb"><div class="ttname"><a href="classstefanfrings_1_1Logger.html#a724e09b39b88c5a880f2405a260949cb">stefanfrings::Logger::mutex</a></div><div class="ttdeci">static QMutex mutex</div><div class="ttdoc">Used to synchronize access of concurrent threads.</div><div class="ttdef"><b>Definition:</b> <a href="logger_8h_source.html#l00134">logger.h:134</a></div></div>
<div class="ttc" id="aclassstefanfrings_1_1Logger_html_a9e6f76da976e3f09962c7613ad7aad8a"><div class="ttname"><a href="classstefanfrings_1_1Logger.html#a9e6f76da976e3f09962c7613ad7aad8a">stefanfrings::Logger::bufferSize</a></div><div class="ttdeci">int bufferSize</div><div class="ttdoc">Size of backtrace buffer, number of messages per thread.</div><div class="ttdef"><b>Definition:</b> <a href="logger_8h_source.html#l00131">logger.h:131</a></div></div>
<div class="ttc" id="aclassstefanfrings_1_1Logger_html_ab7dada738f69e822329edd76889bb758"><div class="ttname"><a href="classstefanfrings_1_1Logger.html#ab7dada738f69e822329edd76889bb758">stefanfrings::Logger::msgFormat</a></div><div class="ttdeci">QString msgFormat</div><div class="ttdoc">Format string for message decoration.</div><div class="ttdef"><b>Definition:</b> <a href="logger_8h_source.html#l00122">logger.h:122</a></div></div>
<div class="ttc" id="alogglobal_8h_html"><div class="ttname"><a href="logglobal_8h.html">logglobal.h</a></div></div>
<div class="ttc" id="alogmessage_8h_html"><div class="ttname"><a href="logmessage_8h.html">logmessage.h</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_dac82461edbf7769d1d161433f435c63.html">logging</a></li><li class="navelem"><a class="el" href="logger_8h.html">logger.h</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
